package thread;

/**
 * 中断异常处理
 */
public class SleepDemo2 {
    public static void main(String[] args) {
        Thread lin = new Thread("kun"){
            public void run(){
                System.out.println(getName()+":睡觉吧");
                try {
                    Thread.sleep(5000000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+":你干嘛，哎呦");
                }
                System.out.println(getName()+":我醒了,需要music");
            }
        };

        Thread huang = new Thread("小黑子"){
            public void run(){
                System.out.println(getName()+":开始砸墙");
                for (int i = 0; i < 5; i++) {
                    System.out.println(getName()+":80!");
                    try {
                        sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println(getName()+":大哥，搞定");
                lin.interrupt();
            }
        };

        lin.start();
        huang.start();
    }
}
